package com.demo.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.demo.core.exception.ParameterException;
import com.demo.domain.User;
import com.demo.domain.ro.ModifyUserInfoRequest;
import jakarta.servlet.http.HttpServletRequest;

import java.util.List;

public interface UserService extends IService<User> {
    public User getUserById(Long userId) throws ParameterException;

    /*
        用户登录，将当前登录成功的用户数据以用户对象的形式返回。
    */
    User loginService(Long userid, String password) throws Exception;

    //修改个人信息并登录
    String loginWithPerfectInfo(User user) throws Exception;

    /*
        用户新增个人信息
     */
    ModifyUserInfoRequest changeInfoService(Long uid, String unickname, String urealname,
                                            String ugender,
                                            String uphone, String umail, String uintro, String uability) throws ParameterException;

    //    根据学号发送验证码到邮箱
    public List<String> getCodeByID(Long uid, HttpServletRequest request) throws ParameterException;

    //修改密码（登录前修改）
    public String modifyPwBeforeLogin(String code, String email, String newPwd, HttpServletRequest request) throws Exception;


    //   在个人信息界面修改密码
//   形参：学号，原密码，新密码，验证码
    public List<Boolean> modifyPwByOriginalPw(Long uid, String originalPw, String newPw, String code, HttpServletRequest request) throws Exception;

    //注销账号
    public String cancelAccount(String code, String email, String pwd, HttpServletRequest request) throws Exception;

    /**
     * 根据id获取姓名
     *
     * @param id
     * @return
     */
    public String getUsenameById(long id);


    //    检验输入的原密码和数据库查询到的密码是否匹配
    public Boolean isMateOriginalPw(Long uid, String originalPw) throws ParameterException;

    //匹配验证码是否正确
    public Boolean isMateCode(String code, String email, HttpServletRequest request) throws Exception;

    //检测用户必要信息是否完善
    public Boolean isPerfectInfo(User user) throws Exception;
}
